Repository navigation
chore(opencode): retry a failed test twice so CI stops failing on runner speed - #75
Merged
Merged
Conversation
Several tests race a real clock and fail on a slow CI runner, on unchanged code. Retrying keeps a PR from going red on runner speed. Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
🔍 PR lacks an issue reference
The description links prior PR #74, but no issue. The repository requires every PR to reference an existing issue; check for a GitHub-linked issue outside the description.
Was this helpful? React with 👍 or 👎 to provide feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the fork's tests retry a failure twice before failing, so a PR stops going red on tests that only lost a race with the clock.
Symptom
The
testjob infork-cifails on unchanged code. On 2026-11-13,devat235aa91passed once and failed once, and #74 at one commit failed three times and then passed. Earlier examples:devon Sep 27 and Oct 15,cutoff-step-retryon Oct 14.Four different tests account for those failures, and none of them failed on a wrong result:
opencode run (non-interactive subprocess): a spawned CLI did not finish inside its 30-second budget (expected exit 0, got -1 after 30280ms, stderrError: Timed out). The tests in that file run concurrently, so several CLI processes boot at once.configured chunkTimeout raises a retryable response stream error when SSE body stalls: a 50 ms timeout has to fire before a 250 ms response body, and did not.session.processor effect tests mark pending tools as aborted on cleanup: interrupted after 21 seconds.Cause
These tests depend on wall-clock time, and GitHub-hosted runners vary. The
Test packages/opencodestep takes 354–545 seconds on passing runs and 493–758 seconds on failing ones, with each test file starting about 1.5× later from the first minute of a slow run.Fix
packages/opencode/bunfig.tomlsetsretry = 2forbun test. Bun retries a failing test up to twice; a test that fails three times in a row still fails.It is set in the package's config file, so it applies to
bun teston a laptop as well as in CI. A CI-only version would be a--retry=2flag infork-ci.yml; that needs a GitHub token with theworkflowscope to push, which the one used here does not have.Not done here: widening each test's time budget, or running the subprocess tests one at a time. Those remove the cause for the tests we know about, but there are at least four of them across three files, and the next one would fail the same way.
Trade-off
A test that genuinely fails one time in three now passes, locally and in CI. That is the cost of not having every PR depend on runner speed.
Tests
Checked in
packages/opencodewith bun 1.3.14 throughbun run test: a test written to fail on its first run and pass on its second now passes, and a test that always fails still fails after its third attempt. This PR's ownfork-cirun is the check on the hosted runners.🤖 Generated with Claude Code
Summary by cubic
Fixes flaky CI failures in
packages/opencodetests that race wall-clock time on slow GitHub-hosted runners.Sets
retry = 2inpackages/opencode/bunfig.tomlsobun testretries a failing test twice before giving up. Several tests depend on timing (a 30-second budget for a spawned CLI, a 50ms stream timeout) and lose the race on loaded runners, failing unchanged code. A test that fails three times in a row still fails.Written for commit c7428fc. Summary will update on new commits.